package org.daverog.jaxrs.iodocs;

import org.apache.cxf.jaxrs.model.wadl.Description;
import org.apache.cxf.jaxrs.model.wadl.Descriptions;
import org.apache.cxf.jaxrs.model.wadl.DocTarget;
import org.daverog.jaxrs.iodocs.API.OfferProduct;
import org.daverog.jaxrs.iodocs.API.ServiceAccount;

import javax.ws.rs.*;

/**
 * Created by IntelliJ IDEA.
 * User: Anjana Kulasinghe
 * Date: 9/26/13
 */

@Path("/query")
public class MyTestApi extends ConvertObjects {


    @POST
    @Path("/resource")
    @IoDocsName("queryName")
    @Descriptions({@Description(value = "Run a query", target = DocTarget.METHOD)})

    public void SamplePostAPI(
            @QueryParam("My Test Api Parameter Integer")
            @Description("My Test Api Parameter Integer Description")
            @IoDocsRequired
            @IoDocsDefaultInteger(2)
            int integerParameter,
            @QueryParam("My Test Api Parameter String")
            @Description("My Test Api Parameter String Description")
            @IoDocsRequired
            @IoDocsDefaultString("Test")
            String stringParameter,
            @QueryParam("My Test Api Parameter Boolean")
            @Description("My Test Api Parameter Boolean Description")
            @IoDocsRequired
            @IoDocsDefaultBoolean(true)
            boolean booleanParameter,
            @QueryParam("My Ignore Test Api Parameter")
            @IoDocsIgnore
            int ignoreParameter,
            @QueryParam("My Test Api Simple Object Parameter")
            @Description("My Test Api Simple Object Parameter Description")
            @IoDocsRequired
            @IoDocsDefaultString("OfferProduct:Object")
            OfferProduct simpleObject,
            @QueryParam("My Test Api Complex Object Parameter")
            @Description("My Test Api Complex Object Parameter Description")
            @IoDocsRequired
            @IoDocsDefaultString("{\\n  \\\"ServiceConfiguration\\\": {\\n    \\\"Id\\\": null,\\n    \\\"Service\\\": " +
                    "{\\n      \\\"Id\\\": null,\\n      \\\"ServiceProvider\\\": {\\n        \\\"Id\\\": null\\n      }," +
                    "\\n      \\\"ServiceCode\\\": null,\\n      \\\"ServiceProviderCollection\\\": null\\n    },\\n    " +
                    "\\\"ServiceList\\\": null\\n  },\\n  \\\"Service\\\": {\\n    \\\"Id\\\": null,\\n    " +
                    "\\\"ServiceProvider\\\": {\\n      \\\"Id\\\": null\\n    },\\n    " +
                    "\\\"ServiceCode\\\": null,\\n    \\\"ServiceProviderCollection\\\": null\\n  },\\n  \\\"Id\\\": null," +
                    "\\n  \\\"ClientId\\\": null,\\n  \\\"ClientReferenceId\\\": null,\\n  \\\"SpServiceAccountId\\\": null\\n}" +
                    ":_:")
            ServiceAccount complexObject) {


    }

    @GET
    public int SampleGetAPI(
            @HeaderParam("My Get API Parameter Name")
            @Description("My Get API Parameter Description")
            @IoDocsRequired
            @IoDocsDefaultInteger(2)
            int getParameter) {
        return getParameter * 10;
    }
}
